﻿<UserControl
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:silvermap="clr-namespace:QUT.Bio.SilverMap"
    xmlns:util="clr-namespace:QUT.Bio.Util"
    x:Class="QUT.Bio.SilverMap.HorizontalLayout2"
    x:Name="UserControl"
    mc:Ignorable="d"
    d:DesignWidth="700"
    d:DesignHeight="700"
    SizeChanged="OnResize">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary
                    Source="/QUT.Bio;component/SilverMap/Simple Styles.xaml" />
                <ResourceDictionary
                    Source="/QUT.Bio;component/SilverMap/Theme.xaml" />
                <ResourceDictionary
                    Source="/QUT.Bio;component/SilverMap/HorizontalLayoutStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    </UserControl.Resources>

    <toolkit:ShinyBlueTheme>

        <Grid
            x:Name="LayoutRoot"
            Background="#FFCEE3F7">
            <Grid
                x:Name="mainPanel"
                VerticalAlignment="Stretch"
                HorizontalAlignment="Stretch"
                Grid.Column="0"
                Grid.ColumnSpan="1"
                Background="{x:Null}">
                <Grid.RowDefinitions>
                    <RowDefinition
                        Height="40" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition
                        x:Name="alignmentColumn"
                        Width="30" />
                    <ColumnDefinition
                        Width="1*" />
                    <ColumnDefinition
                        x:Name="summaryColumn"
                        Width="30" />
                </Grid.ColumnDefinitions>
                <StackPanel
                    Orientation="Horizontal"
                    Grid.Row="0"
                    Margin="10,5"
                    HorizontalAlignment="Center"
                    Grid.Column="1">
                    <TextBlock
                        Text="Query"
                        FontSize="12"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left"
                        Margin="5,0"
                        Foreground="Black" />

                    <silvermap:HistoryPanel
                        x:Name="historyPanel"
                        Margin="5,0"
                        VerticalAlignment="Center"
                        MinWidth="200" />

                    <!-- Search functionality is not available in the present iteration. -->
                    <TextBlock
                        Text="Search"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left"
                        Margin="10,0,5,0"
                        Foreground="Black"
                        Visibility="Collapsed" />

                    <!-- Search functionality is not available in the present iteration. -->
                    <silvermap:SearchControl
                        x:Name="searchControl"
                        Margin="5,0"
                        VerticalAlignment="Center"
                        MinWidth="200"
                        HorizontalAlignment="Stretch"
                        Visibility="Collapsed" />
                </StackPanel>
                <silvermap:View
                    x:Name="view"
                    Grid.Row="1"
                    VerticalAlignment="Stretch"
                    Margin="10,5,10,10"
                    MinHeight="400"
                    Background="{x:Null}"
                    Grid.Column="1" />
            </Grid>

            <util:Expander
                x:Name="alignmentExpander"
                ExpandDirection="Left"
                Margin="0"
                HorizontalAlignment="Left"
                d:LayoutOverrides="Width"
                ScrollViewer.HorizontalScrollBarVisibility="Auto"
                ScrollViewer.VerticalScrollBarVisibility="Auto"
                MinWidth="0"
                VerticalAlignment="Stretch"
                Padding="0"
                Collapsed="alignmentExpander_Collapsed"
                MouseLeave="alignmentExpander_MouseLeave"
                MouseEnter="alignmentExpander_MouseEnter"
                Style="{StaticResource ExpanderStyleLeft}">
                <Grid
                    x:Name="alignmentPanel"
                    Height="Auto"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                    ScrollViewer.VerticalScrollBarVisibility="Disabled"
                    Width="Auto"
                    Margin="0"
                    MinWidth="100">
                	<Grid.Background>
                		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                			<GradientStop Color="#FFBAE4FF" Offset="0"/>
                			<GradientStop Color="#FF0A3E69" Offset="1"/>
                		</LinearGradientBrush>
                	</Grid.Background>
                    <Grid.RowDefinitions>
                        <RowDefinition
                            Height="0*"
                            MaxHeight="15"
                            MinHeight="15" />
                        <RowDefinition
                            Height="0*"
                            MaxHeight="30"
                            MinHeight="30" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <TextBlock
                        FontSize="16"
                        HorizontalAlignment="Center"
                        Grid.Row="1"
                        Margin="0,0,5,0"><Run
                            Text="Alignment" /></TextBlock>

                    <silvermap:HitStack
                        x:Name="alignment"
                        ScrollViewer.VerticalScrollBarVisibility="Disabled"
                        VerticalContentAlignment="Top"
                        Margin="0,0,5,10"
                        Grid.Row="2"
                        MinHeight="0" />

                    <ToggleButton
                        x:Name="alignmentToggle"
                        Content=""
                        HorizontalAlignment="Right"
                        Margin="0,0,7,0"
                        Width="15"
                        Height="15"
                        Click="alignmentButton_Click"
                        VerticalAlignment="Top"
                        BorderThickness="2" />
                    <Thumb
                        x:Name="alignmentThumb"
                        Margin="0"
                        DragDelta="Thumb_DragDelta"
                        Width="5"
                        Height="{Binding ActualHeight, ElementName=alignmentExpander}"
                        HorizontalAlignment="Right"
                        Grid.RowSpan="3"
                        Cursor="SizeWE"
                        HorizontalContentAlignment="Right"
                        VerticalContentAlignment="Stretch"
                        IsTabStop="False"
                        BorderBrush="{x:Null}">
                    	<Thumb.Background>

                    		<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                    			<LinearGradientBrush.RelativeTransform>
                    				<CompositeTransform CenterY="0.5" CenterX="0.5" Rotation="90"/>
                    			</LinearGradientBrush.RelativeTransform>
                    			<GradientStop Color="#FF98DAFF"/>
                    			<GradientStop Color="#FF0A3E69" Offset="1"/>
                    		</LinearGradientBrush>

                    	</Thumb.Background>
                    </Thumb>
                </Grid>
            </util:Expander>

            <util:Expander
                x:Name="summaryExpander"
                ExpandDirection="Right"
                IsExpanded="False"
                Margin="0"
                HorizontalAlignment="Right"
                Grid.Column="2"
                d:LayoutOverrides="Width"
                ScrollViewer.HorizontalScrollBarVisibility="Auto"
                ScrollViewer.VerticalScrollBarVisibility="Auto"
                Collapsed="summaryExpander_Collapsed"
                MouseEnter="summaryExpander_MouseEnter"
                MouseLeave="summaryExpander_MouseLeave"
                Style="{StaticResource ExpanderStyleLeft}">

                <Grid
                    x:Name="summaryPanel"
                    ScrollViewer.HorizontalScrollBarVisibility="Auto"
                    ScrollViewer.VerticalScrollBarVisibility="Auto"
                    Margin="0"
                    MinWidth="350"
                    Width="450">
                    <Grid.Background>
                        <LinearGradientBrush
                            EndPoint="0.5,1"
                            StartPoint="0.5,0">
                            <GradientStop
                                Color="#FFBAE4FF"
                                Offset="0" />
                            <GradientStop
                                Color="#FF0A3E69"
                                Offset="1" />
                        </LinearGradientBrush>
                    </Grid.Background>

                    <Grid.RowDefinitions>
                        <RowDefinition
                            Height="0*"
                            MaxHeight="15"
                            MinHeight="15" />
                        <RowDefinition
                            Height="0*"
                            MaxHeight="30"
                            MinHeight="30" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <ToggleButton
                        x:Name="summaryToggle"
                        Content=""
                        HorizontalAlignment="Left"
                        Margin="7,0,0,0"
                        Width="15"
                        Height="15"
                        Click="summaryButton_Click"
                        VerticalAlignment="Top" />

                    <TextBlock
                        x:Name="sequenceSummaryLiteral"
                        Grid.Row="1"
                        VerticalAlignment="Center"
                        FontSize="16"
                        Text="Summary"
                        HorizontalAlignment="Center" />

                    <TextBlock
                        x:Name="sequencePropertyLiteral"
                        Grid.Row="1"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"
                        FontSize="16"
                        Text="Hit Details"
                        Visibility="Collapsed" />

                    <TextBlock
                        x:Name="geneDetailsLiteral"
                        Grid.Row="1"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"
                        FontSize="16"
                        Text="Gene Details"
                        Visibility="Collapsed" />

                    <util:TabControl
                        Grid.Row="2"
                        TabStripPlacement="Bottom"
                        x:Name="infoContainer"
                        BorderThickness="1"
                        SelectionChanged="infoContainer_SelectionChanged"
                        Margin="10,0,10,10">

                        <util:TabItem
                            Header="Summary"
                            x:Name="sequenceSummaryContainer"
                            FontSize="12"
                            BorderThickness="1">

                            <silvermap:SequenceSummaryTable
                                x:Name="sequenceSummaryTable"
                                VerticalAlignment="Stretch"
                                Foreground="Black" />
                        </util:TabItem>

                        <util:TabItem
                            Header="Hit details"
                            FontSize="12"
                            x:Name="sequencePropertyContainer"
                            BorderThickness="1">

                            <silvermap:SequencePropertyPanel
                                x:Name="sequencePropertyPanel"
                                Foreground="Black" />
                        </util:TabItem>

                        <util:TabItem
                            Header="Gene details"
                            x:Name="geneDetailsContainer"
                            Visibility="Collapsed"
                            FontSize="12"
                            BorderThickness="1"
                            Foreground="Black">

                            <Grid
                                x:Name="geneDetailsPanel" />
                        </util:TabItem>

                    </util:TabControl>
                    <Thumb
                        x:Name="summaryThumb"
                        Margin="0"
                        DragDelta="summaryThumb_DragDelta"
                        Width="5"
                        Height="{Binding ActualHeight, ElementName=alignmentExpander}"
                        HorizontalAlignment="Left"
                        Grid.RowSpan="3"
                        Cursor="SizeWE"
                        HorizontalContentAlignment="Right"
                        VerticalContentAlignment="Stretch"
                        IsTabStop="False"
                        BorderBrush="{x:Null}">
                        <Thumb.Background>
                            <LinearGradientBrush
                                EndPoint="0.5,1"
                                StartPoint="0.5,0">
                            	<LinearGradientBrush.RelativeTransform>
                            		<CompositeTransform CenterY="0.5" CenterX="0.5" Rotation="280"/>
                            	</LinearGradientBrush.RelativeTransform>
                                <GradientStop
                                    Color="#FFBAE4FF"
                                    Offset="1" />
                                <GradientStop
                                    Color="#FF0A3E69" />
                            </LinearGradientBrush>
                        </Thumb.Background>
                    </Thumb>

                </Grid>
            </util:Expander>
        </Grid>
    </toolkit:ShinyBlueTheme>
</UserControl>